load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "rpm",
    srcs = [
        "cpio2tar.go",
        "rpm.go",
        "tar.go",
    ],
    importpath = "github.com/rmohr/bazeldnf/pkg/rpm",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/api",
        "//pkg/xattr",
        "@com_github_sassoftware_go_rpmutils//:go-rpmutils",
        "@com_github_sassoftware_go_rpmutils//cpio",
        "@com_github_sirupsen_logrus//:logrus",
    ],
)

go_test(
    name = "rpm_test",
    srcs = [
        "rpm_test.go",
        "tar_test.go",
    ],
    data = [
        "@bazeldnf_internal_abseil-cpp-devel//rpm",
        "@bazeldnf_internal_libvirt-devel//rpm",
        "@bazeldnf_internal_libvirt-libs//rpm",
    ],
    embed = [":rpm"],
    env = {
        "CPP_DEVEL": "$(rlocationpath @bazeldnf_internal_abseil-cpp-devel//rpm)",
        "LIBVIRT_DEVEL": "$(rlocationpath @bazeldnf_internal_libvirt-devel//rpm)",
        "LIBVIRT_LIBS": "$(rlocationpath @bazeldnf_internal_libvirt-libs//rpm)",
    },
    deps = [
        "//pkg/api",
        "@com_github_onsi_gomega//:gomega",
        "@rules_go//go/runfiles",
    ],
)
